import Vue from 'vue'
import App from './App.vue'
import store from './store'
import locale from './locale/locale.json'
import _ from 'lodash'

new Vue({ // eslint-disable-line no-new
    el: '#app',
    store,
    render: (h) => h(App)
})

Vue.filter('translate', code => {
    if (!_.isString(code)) return code
    switch (store.getters.locale) {
        case 'zh-CN':
            if (!_.isEmpty(locale[_.camelCase(code)])) {
                code = locale[_.camelCase(code)]['zh-CN'] || locale[_.camelCase(code)]['en-US'] || code
            }
            break
    }
    return code
})
